<?php

namespace Iyting\Tiktok\MiniProgram\Trade;

use Iyting\Tiktok\Kernel\BaseClient;

class Fulfillment extends BaseClient
{
    protected $needAccessToken = false;
    protected $needClientToken = true;
    protected  $baseUri = 'https://open.douyin.com/api/apps/trade/v2/';


    public function pushDelivery($order)
    {
        $area = $order['stage_play']['area'];
        $params['out_order_no'] = $order['billcode'];
        $params['use_all'] = true;
        $params['poi_info'] = self::json_encode(['shop_name'=>$area['name'],'ext_valid_shop_id'=>(string) $area['id'],'valid_poi_id_str'=>$order['stage_play']['poi']]) ;

        return $this->httpPostJson('fulfillment/push_delivery',$params);

    }
}